package com.qdu.servlet;

import com.qdu.entity.Log;
import com.qdu.entity.LogRemark;
import com.qdu.service.impl.LogRemarkServiceImpl;
import com.qdu.service.impl.LogResponseServiceImpl;
import com.qdu.service.impl.LogServiceImpl;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 从主页面点击，查看一个日志的servlet
 *
 * @author Lenovo
 */
@WebServlet("/solfm")
public class selectOneLogFromMain extends HttpServlet{

    LogServiceImpl logserviceimpl=new LogServiceImpl();
    LogRemarkServiceImpl logremarkserviceimpl=new LogRemarkServiceImpl();
    LogResponseServiceImpl logresponseserviceimpl=new LogResponseServiceImpl();
    
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        
        String id=req.getParameter("logId");
        
        Log log=logserviceimpl.getOneLogById(id);
        List<Log> list=logserviceimpl.getAllLog();
        List<LogRemark> remark=logremarkserviceimpl.getAllRemark(id);
        
        req.setAttribute("log",log);
        req.setAttribute("list",list);
        req.setAttribute("remark",remark);
        
        req.getRequestDispatcher("/mainOneLog.jsp").forward(req, resp);
    }

    
}
